	var serverData = {};
    var	serverTable;
    jQuery(document).ready(function () {
    	serverTable=  jQuery('#dataTable').DataTable({
    		          "serverSide": true,
    		          "ordering": false,
			            "ajax": {
			                "dataType": "json",
			                "type": "get",
			                "cache": false,
			                "url":window.rootPath+ '/ui/inventoryDull/getpage',
			                "data": function (d) {
			                    return $.extend({}, d, serverData);
			                }
			            },
			            columns: [
			                {
			                	data: null,
			                	defaultContent: ""
			                },
			                {
			                    data: null,
			                    defaultContent: "",
			                    render: function (data, type, full, meta) {
			                        var operate =' <input type="checkbox" class="minimal-red myCheckbox" />';
			                        return operate;

			                    }
			                },
			                {
			                    data: 'figureNum',
								render:function(data,type,full,meta){
									if(data == null || data == undefined || data == ""){
										return data;
									}else{
										return (data.length > 40) ? '<font title="'+data+'">'+data.substring(0,40)+'...'+'</font>' : data;
									}
									//return "<div title='"+data+"' style='overflow:hidden; text-overflow:ellipsis; white-space:nowrap;'>"+data+"</div>"
								}
			                },
			                {
			                    data: 'name',
								render:function(data,type,full,meta){
									if(data == null || data == undefined || data == ""){
										return data;
									}else{
										return (data.length > 40) ? '<font title="'+data+'">'+data.substring(0,40)+'...'+'</font>' : data;
									}
									//return "<div title='"+data+"' style='overflow:hidden; text-overflow:ellipsis; white-space:nowrap;'>"+data+"</div>"
								}
			                },
			                {
			                    data: 'material',
								render:function(data,type,full,meta){
									if(data == null || data == undefined || data == ""){
										return data;
									}else{
										return (data.length > 40) ? '<font title="'+data+'">'+data.substring(0,40)+'...'+'</font>' : data;
									}
									//return "<div title='"+data+"' style='overflow:hidden; text-overflow:ellipsis; white-space:nowrap;'>"+data+"</div>"
								}
			                },
			                {
			                	data: 'number'
			                },
			                {
			                	data: 'usableNum'
			                },
			                {
			                	data:null,
			                	 defaultContent: "",
				                    render: function (data, type, full, meta) {
				                        return data.number-data.usableNum;
				                    }
			                }
			                ],
			            "drawCallback": function (oSettings) {
			                var k = 0;
			                var total = oSettings.aiDisplay.length + oSettings._iDisplayStart;
			                for (var i = oSettings._iDisplayStart, iLen = total; i < iLen; i++) {
			                    $('td:eq(0)', oSettings.aoData[oSettings.aiDisplay[k]].nTr).text(i + 1);
			                    k++;
			                }
			            }
			        });

			    });
			    
			    //查询
			    jQuery(".searchBtn").on('click',function(){
			    	serverData.key=jQuery("#keyword").val();
			    	serverTable.draw();
			    });
			    
			    //撤消
			    jQuery(".resetBtn").on('click',function(){
			    	jQuery("#keyword").val('');
			    	serverData.key='';
			    	serverTable.draw();
			    });
			    
